package com.lx.cloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;

/**
 * @ClassName TestController
 * @Description
 * @Author ymy
 * @Date 2021/2/20 9:43
 */
@RestController
public class TestController {

    @Value("${server.port}")
    private String port;

    @Value("${spring.application.name}")
    private String applicationName;

    @GetMapping(value = "/test")
    public String test(HttpServletRequest request){
        System.out.println("------："+request.getHeader("Accept-Language"));
        Enumeration e=request.getHeaderNames();
        while(e.hasMoreElements()){
            String name=request.getHeader((String) e.nextElement());
            System.out.println("name-->"+name);
            System.out.println("----------------------------");
        }


        return "hello, 端口："+port+",服务名："+applicationName;
    }

}
